<script setup lang="ts">
import { ref } from 'vue'

const imgUrl = ref('https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png')
const imgUrl2 = ref('https://www.itheima.com/images/logo.png')
const msg = ref('百度一下')
const isActive = ref(true)
</script>


<template>
  <!-- <img v-bind:src="imgUrl" v-bind:title="msg" alt=""> -->
  <img :src="isActive?imgUrl:imgUrl2" :title="msg" alt="">
  <button :class="{red: isActive}" @click="isActive = !isActive">点击切换</button>
</template>

<style>
.red {
  color: red;
}
</style>
